<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\common\model;


/**
 * Currency模型
 */
class Wallet extends ModelBase
{

    protected $insert = ['create_time'];




    /**
     * 时间自动完成
     */
    public function setCreateTimeAttr()
    {

        return TIME_NOW;
    }

    /**
     * logo
     */
    public function getImageAttr()
    {
        return get_picture_url($this->cover_id,false);
    }

    /**
     * logo
     */
    public function getTransferMinAttr($value)
    {
        if(in_array($this->id,[1,2,3])){
            return  sprintf("%.2f",$value);
        }else{
            return $value;
        }
    }

//    /**
//     * logo
//     */
//    public function getParitiesAttr($value)
//    {
//            if(in_array($this->id,[6,7,8]) ){
//                return $value-getConfig('eth_reduce_price');
//            }else{
//                return $value;
//            }
//    }

    /**
     * logo
     */
    public function getTransferMaxAttr($value)
    {
        if(in_array($this->id,[1,2,3])){
            return  sprintf("%.2f",$value);
        }else{
            return $value;
        }
    }

    public function  getNameAttr($value){

        if( isset($_REQUEST['lang']) && $_REQUEST['lang']!='zh-cn' &&  $_REQUEST['lang'] ){
            return   baidu_translate($value);
        }
        return $value;

    }

}
